<?php
/**
 * Created by PhpStorm.
 * User: 26243
 * Date: 2017/5/6
 * Time: 13:19
 */
require_once '../include.php';
session_start();
$productid = intval($_POST['productid']);
//var_dump($productid);
$num = intval($_POST['num']);
//var_dump($num);
$userid = $_SESSION['loginFlag'];
global $link;
//$table = 'shop_cart';
//$arr = array($productid,$userid,$num);
$sql = "update shop_cart set num=$num WHERE productid={$productid} AND userid={$userid}";
$result = mysqli_query($link,$sql);
if ($result) {
    $response = array(
        'errno' => 0,
        'errmsg' => '修改成功',
        'data' => true,
    );
}else{
    $response = array(
        'errno' => -1,
        'errmsg' => '修改失败',
        'data' => flase,
    );
}

echo json_encode($response);